package com.bestsoft.web.controller.flow;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.bestsoft.common.annotation.Log;
import com.bestsoft.common.core.controller.BaseController;
import com.bestsoft.common.core.domain.AjaxResult;
import com.bestsoft.common.enums.BusinessType;
import com.bestsoft.flow.domain.Htxsml;
import com.bestsoft.flow.service.IHtxsmlService;
import com.bestsoft.common.utils.poi.ExcelUtil;
import com.bestsoft.common.core.page.TableDataInfo;

/**
 * 恒泰销售毛利查询Controller
 * 
 * @author 崔健
 * @date 2023-10-09
 */
@RestController
@RequestMapping("/flow/htxsml")
public class HtxsmlController extends BaseController
{
    @Autowired
    private IHtxsmlService htxsmlService;

    /**
     * 查询恒泰销售毛利查询列表
     */
    @PreAuthorize("@ss.hasPermi('flow:htxsml:list')")
    @GetMapping("/list")
    public TableDataInfo list(Htxsml htxsml)
    {
        startPage();
        List<Htxsml> list = htxsmlService.selectHtxsmlList(htxsml);
        return getDataTable(list);
    }

    /**
     * 导出恒泰销售毛利查询列表
     */
    @PreAuthorize("@ss.hasPermi('flow:htxsml:export')")
    @Log(title = "恒泰销售毛利查询", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, Htxsml htxsml)
    {
        List<Htxsml> list = htxsmlService.selectHtxsmlList(htxsml);
        ExcelUtil<Htxsml> util = new ExcelUtil<Htxsml>(Htxsml.class);
        util.exportExcel(response, list, "恒泰销售毛利查询数据");
    }

    /**
     * 获取恒泰销售毛利查询详细信息
     */
    @PreAuthorize("@ss.hasPermi('flow:htxsml:query')")
    @GetMapping(value = "/{xh}")
    public AjaxResult getInfo(@PathVariable("xh") Long xh)
    {
        return success(htxsmlService.selectHtxsmlByXh(xh));
    }

    /**
     * 新增恒泰销售毛利查询
     */
    @PreAuthorize("@ss.hasPermi('flow:htxsml:add')")
    @Log(title = "恒泰销售毛利查询", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Htxsml htxsml)
    {
        return toAjax(htxsmlService.insertHtxsml(htxsml));
    }

    /**
     * 修改恒泰销售毛利查询
     */
    @PreAuthorize("@ss.hasPermi('flow:htxsml:edit')")
    @Log(title = "恒泰销售毛利查询", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Htxsml htxsml)
    {
        return toAjax(htxsmlService.updateHtxsml(htxsml));
    }

    /**
     * 删除恒泰销售毛利查询
     */
    @PreAuthorize("@ss.hasPermi('flow:htxsml:remove')")
    @Log(title = "恒泰销售毛利查询", businessType = BusinessType.DELETE)
	@DeleteMapping("/{xhs}")
    public AjaxResult remove(@PathVariable Long[] xhs)
    {
        return toAjax(htxsmlService.deleteHtxsmlByXhs(xhs));
    }
}
